home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 007 / crit.arc / TESTCRIT.C < prev   
C/C++ Source or Header  |  1986-12-01  |  689b  |  26 lines

  1. #include <stdio.h>
  2. main(argc,argv)
  3. int argc;
  4. char **argv;
  5. {
  6.     FILE *foo = NULL;
  7.     static char fnamebuf[65];
  8.     /* attempt to open the file specified by the first command line
  9.     ** argument
  10.     */
  11.     sprintf(fnamebuf,"A:%s",argv[1]);    /* build the file name */
  12.     for (;foo == NULL;)
  13.     {
  14.         if (-1 == setup_crit())    /* set up error handler */
  15.         {
  16.             /* if an error occurs, you will end up here */
  17.             fprintf(stderr,"Check to make sure a valid disk is drive A:\n");
  18.             fprintf(stderr,"and that the drive door is closed\n");
  19.             fprintf(stderr,"Hit return to continue\n");
  20.             getchar();
  21.         }
  22.         foo = fopen(fnamebuf,"r");
  23.     }
  24.     restore_crit();    /* turn off critical error handling */
  25. }
  26.